import React, { Component, PropTypes } from 'react';
import Style from './index.scss'

class Process extends Component {
    constructor(props) {
        super(props);

    }

    /**
     * 获取指定的时间
     * @param type 类型:day(2017-02-28) h(11:35)
     */
    getTimes(type = 'day') {
        let time = this.props.handleDate;
        console.log(time)
        let pos = time.indexOf(' '); //空格的位置
         return type === 'day' ? time.substr(0, pos) : time.substr(pos + 1, 5)
    }

    componentWillMount() {
        console.log()
    }

    componentDidMount() {

    }

    componentWillUnmount() {

    }

    render() {
        return (
          // ' hor'
            <div className={Style.process }>
                {this.props.isCurrent ?
                    <div className={Style.progress}>
                        <img src={this.props.fail ?'./images/process-icon.png' :'./images/process-error-icon.png'}/>
                    </div>
                    :
                    <div className={Style.progress + ' ' + Style.notCurrent}></div>
                }

                <div className={Style.text}>
                    <div className={Style.title + ' text-overflow-one'}>{this.props.handleMsg}</div>
                    <div className={Style.msg}>{this.props.handleRemark}</div>
                    <div className={Style.time_D}>{this.props.handleDate}</div>
                </div>
            </div>
        );
    }
}

Process.propTypes = {

};


Process.defaultProps = {
    isCurrent: false, //处于当前进度
    time: '2017-02-28 11:59:49',
    title: <span>这里是标题的</span>, //标题
    msg: <p>这里是详细描述的信息这里是详细描述的信息这里是详细描述的信息<a>138000000008</a></p>, //详细描述
   // fail: true, //失败
}

export default Process;